package flc.ast.activity;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;

import com.blankj.utilcode.util.ToastUtils;
import com.bumptech.glide.Glide;

import flc.ast.BaseAc;
import flc.ast.R;
import flc.ast.databinding.ActivityWallpaperPreviewBinding;

public class WallpaperPreviewActivity extends BaseAc<ActivityWallpaperPreviewBinding> {

    public static String url;

    @Override
    protected int onCreate() {
        return R.layout.activity_wallpaper_preview;
    }

    @Override
    protected void initView() {
        mDataBinding.ivWallpaperPriviewBack.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                onBackPressed();
            }
        });
        Glide.with(mContext).load(url).into(mDataBinding.ivWallpaperImg);
        mDataBinding.ivWallpaperImg.setOnTouchListener(new View.OnTouchListener() {
            private int x,y;
            @Override
            public boolean onTouch(View v, MotionEvent event) {
                switch (event.getAction()){
                    case MotionEvent.ACTION_DOWN:
                        x = (int) event.getRawX();
                        y = (int)event.getRawY();
                        break;
                    case MotionEvent.ACTION_MOVE:
                        int nowX = (int) event.getRawX();
                        int nowY = (int) event.getRawY();
                        int movedX = nowX - x;
                        int movedY = nowY - y;
                        x = nowX;
                        y = nowY;
//                        ToastUtils.showShort(""+movedY);
                        if (movedY<-50){
                            mDataBinding.ivWallpaperPriviewImg.setImageResource(R.drawable.aazpm);
                        }
                        break;
                }
                return true;
            }
        });
    }

    @Override
    protected void initData() {

    }
}